<?php

namespace App\JsonRpc;
/**
 * This file is part of Hyperf Mall.
 *
 * @link     https://gitee.com/scwlkj/hypref_mall
 * contact  hyperf_mall@163.com
 */
use App\JsonRpc\Interfaces\AuthServiceInterface;
use App\Repository\AuthRepository;
use Hyperf\RpcServer\Annotation\RpcService;

/**
 * @RpcService(name="Member::AuthService", protocol="jsonrpc", server="jsonrpc")
 */
class AuthService extends BaseService implements AuthServiceInterface
{
    public function init()
    {
        $this->repository = AuthRepository::getInstance();
    }

    /**
     * Notes:登录
     * Author:Jurij.cao
     * Date:2022/6/27
     * @param int $type
     * @param array $data
     * @return array
     */
    public function login(int $type, array $data): array
    {
        return $this->repository->login($type, $data);
    }

    /**
     * Notes:token换取信息
     * Author:Jurij.cao
     * Date:2022/6/27
     * @param int $type
     * @param string $token
     * @return mixed
     */
    public function getInfo(int $type, string $token)
    {
        return $this->repository->getInfo($type, $token);
    }
}
